import os
import logging

def parseOptions(optionStr):
	theme = 'black'
	music = False
	
	if ("am", "ma", "a").__contains__(optionStr):
		theme = 'alien'
		if ("am", "ma").__contains__(optionStr):
			music = True
	elif ("om", "mo", "o").__contains__(optionStr):
		theme = 'bird'
		if ("m", "mo").__contains__(optionStr):
			music = True
	elif ("cm", "mc", "c").__contains__(optionStr):
		theme = 'color'
		if ("cm", "mc").__contains__(optionStr):
			music = True
	elif ("sm", "ms", "s").__contains__(optionStr):
		theme = 'sky'
		if ("sm", "ms").__contains__(optionStr):
			music = True
	elif ("tm", "mt", "t").__contains__(optionStr):
		theme = 'teddybear'
		if ("tm", "mt").__contains__(optionStr):
			music = True
	elif ("wm", "mw", "w").__contains__(optionStr):
		theme = 'white'
		if ("wm", "mw").__contains__(optionStr):
			music = True
	elif optionStr:
		if optionStr[0:1] == "m":
			music = True
			optionStr = optionStr[1:]
		if getListOfThemes().__contains__(optionStr):
			theme = optionStr
	return {
		"theme": "themes/" + theme + ".html",
		"music": music
	}

def getListOfThemes():
	dirs = os.listdir("templates/themes")
	list = []
	for d in dirs:
		list.append(d[0:-5])
	return list